/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package guzik.lukasz.SnpDataAPI;

import guzik.lukasz.SnpDataAPI.implementation.SnpDataAPIImpl;
import SnpDbEntities.Category;
import SnpDbEntities.Snippet;
import SnpDbEntities.User;
import java.util.ArrayList;
import java.util.LinkedHashMap;

/**
 *
 * @author Łukasz 'byku' Guzik
 */
public abstract class SnpDataAPI
{
    private static SnpDataAPI instance;

    public static SnpDataAPI getDefault()
    {
	if(instance == null)
	{
	    instance = new SnpDataAPIImpl();
	}

	return instance;
    }

    public abstract boolean connectAndAuth(String login, String password) throws
	    Exception;

    public abstract void disconnect();

    public abstract User getConnectedUser();

    public abstract LinkedHashMap<Integer, Category> getAllPublicCategories();

    public abstract LinkedHashMap<Integer, Category> getAllPrivateCategories();

    public abstract LinkedHashMap<Integer, Snippet> getAllPublicSnippets();

    public abstract LinkedHashMap<Integer, Snippet> getAllPrivateSnippets();

    public abstract Snippet getSnippetWithData(int snippetId, boolean isPublic);

    public abstract User getUser(int userId);

    public abstract int addCategory(Category newCat, boolean isPublic);

    public abstract boolean updateCategory(Category newCat, boolean isPublic);

    public abstract boolean removeCategory(int catId, boolean isPublic);

    public abstract int addPrivateSnippet(Snippet newSnp);

    public abstract boolean updateSnippet(Snippet newSnp, boolean withData, boolean isPublic);

    public abstract boolean removePrivateSnippet(int snpId);

    public abstract boolean addToPublishQueue(int snpId, int publicCatId);

    public abstract boolean removeFromPublishQueue(int snpId);

    public abstract boolean publish(int snpId);

    public abstract boolean unpublish(int snpId);

    public abstract LinkedHashMap<Integer, Snippet> getSnippetsToPublish();

    public abstract ArrayList<Integer> getCategoryModerators(int catId);

    public abstract LinkedHashMap<Integer, User> getUsersList();

    public abstract int addUser(User newUser);

    public abstract boolean updateUser(User newUserData);

    public abstract boolean removeUser(int userId);

    public abstract boolean addModeratorToCategory(int modId, int catId);

    public abstract boolean removeModeratorFromCategory(int modId, int catId);
}
